package itheima.lianxi2;

import java.util.Random;

public class Test {
    public static void main(String[] args) {
        String s = getStr();
        System.out.println(s);
    }

    public static String getStr(){
        // 先定义String getStr()方法。
        String str = "";
        // 创建Random对象
        Random r = new Random();
        StringBuilder sb = new StringBuilder();
        for(int i = 1; i<= 5;i++){
            // 如何随机生成A-Z之间的字符？     A-Z 对应的数字是 65-90
            if (i == 1){
                sb.append(r.nextInt(10));
            }else{
                int x = r.nextInt(26) + 65;
                char ch = (char)x;
                sb.append(ch);
            }
            str = sb.toString();
        }
        return str;
    }
}
